/*
 * @Author: zhuxiaoyi
 * @Date: 2021-10-28 12:40:36
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2024-07-02 17:12:47
 * @Description:
 */
import service from "@/utils/request";
import AlgorithmList from "@/views/index/general/algorithmManage/algorithmList/algorithmList.vue";

const geoserverBaseURL = "/geoserver/rest";
const backEndBaseURL = "/algorithmApi";

// const BASE_URL = "/zyjy-knowleges-api";
export default {
  login: {
    loginSystemURL: "/oauth/token",
    loginSystem: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postQuery(
        this.loginSystemURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  sldManage: {
    getStylesURL: "/workspaces/result/styles",
    getStyles: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        geoserverBaseURL + this.getStylesURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getSldURL: "/workspaces/result/styles",
    getSld: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        geoserverBaseURL + this.getSldURL + "/" + params.name + ".sld",
        params,
        successCallBack,
        errorCallBack
      );
    },
    deleteSldURL: "/workspaces/result/styles",
    deleteSld: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.deleteQuery(
        geoserverBaseURL + this.getSldURL + "/" + params.name,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  algorithmManage: {
    AlgorithmsURL: "/algorithm",
    getAlgorithms: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.AlgorithmsURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    deleteAlgorithm: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.deleteJson(
        backEndBaseURL + this.AlgorithmsURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getAlgorithmByIdURL:"/algorithm/getAlgorithmById",
    getAlgorithmById: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getAlgorithmByIdURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    updateAlgorithm: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.AlgorithmsURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    executeAlgorithm: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.AlgorithmsURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  taskManage: {
    taskURL: "/task",
    getTasks: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.taskURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    deleteTask: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.deleteJson(
        backEndBaseURL + this.taskURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getTreeTasksURL: "/task/tree",
    getTreeTasks: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getTreeTasksURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    updateTaskStatusURL: "/task/changeStatus",
    updateTaskStatus: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.updateTaskStatusURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    publishResultURL: "/task/publish",
    publishResult: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.publishResultURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    pushResultURL: "/task/pushResult",
    pushResult: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.pushResultURL + `/${params.id}`,
        params,
        successCallBack,
        errorCallBack
      );
    },
    statusListenURL: "/task/statusListen",
    statusListen: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.statusListenURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  processListManage: {
    getprocessListURL: "/graph/getGraphs",
    getprocessList: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getprocessListURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getProcessURL: "/graph/getGraph",
    getProcess: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getProcessURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getDynamicDataURL: "/graph/getDynamicData",
    getDynamicData: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getDynamicDataURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    editDynamicDataURL: "/graph/editDynamicData",
    editDynamicData: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        backEndBaseURL + this.editDynamicDataURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    addProcessURL: "/graph/addGraph",
    addProcess: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        backEndBaseURL + this.addProcessURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    updateProcessURL: "/graph/updateGraph",
    updateProcess: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.updateProcessURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    deleteProcessURL: "/graph/deleteGraph",
    deleteProcess: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.deleteJson(
        backEndBaseURL + this.deleteProcessURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getAlgorithmParamsURL: "/graph/getNodeParams",
    getAlgorithmParams: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        backEndBaseURL + this.getAlgorithmParamsURL + "/" + params.graphId,
        params,
        successCallBack,
        errorCallBack
      );
    },
    updateNodeParamsURL: "/graph/updateNodeParams",
    updateNodeParams: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.updateNodeParamsURL + "/" + params.graphId,
        params,
        successCallBack,
        errorCallBack
      );
    },
    executeGraphURL: "/graph/executeGraph",
    executeGraph: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.executeGraphURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    changePauseStatusURL:"/graph/changePauseStatus",
    changePauseStatus: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        backEndBaseURL + this.changePauseStatusURL + "/" + params.graphId,
        params,
        successCallBack,
        errorCallBack
      );
    },
    continueToExcuteURL:"/promise/trigger",
    continueToExcute: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.continueToExcuteURL + "/" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  module1Manage: {
    getPorductsURL: "/module1/getProducts",
    getPorducts: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getPorductsURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  foldersManage:{
    getFoldersURL:"/folder/getLazyFolderContent",
    getFolders: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        backEndBaseURL + this.getFoldersURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getFilesURL:"/folder/fileList",
    getFiles:function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        backEndBaseURL + this.getFilesURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  AlgorithmTypeManage:{
    getTreeURL:"/algorithmType/getTree",
    getTree:function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        backEndBaseURL + this.getTreeURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  }
};
